Re: [GENERAL] Problem with perl / postgres - Mailing list pgsql-general

From Stuart Rison
Subject Re: [GENERAL] Problem with perl / postgres
Date
Msg-id v04020a00b38ead7a6764@[128.40.242.190]
Whole thread Raw
In response to Problem with perl / postgres  (Chris Bitmead <chris.bitmead@bigfoot.com>)
List pgsql-general
Hi Chris,

I don't know why it works in psql but not in perl but I've had problems
casting datetime as date before.

In pg 6.4 the cast fails (and by that I mean it yields an error) if
datetime is NULL.  A possible 'workaround' is to double-cast:

select date( abstime( dt ) ) from test1;

Now because your query works in psql but not in perl, I don't think that
casting of NULLs is likely to be the problem but hey, it's worth a shot.

On a final note, I think datetime and date are reserved keywords so it's
probably best to rename your attribute 'datetime' and your synonym 'date'!

HTH,

Stuart.

>I've got this simple query...
>
>SELECT id, title, summary, datetime, datetime::date AS date FROM poll
>WHERE id = ?
>
>which works from psql but fails with "bad parameter" from perl. If I
>take out the "datetime::date AS date" bit it starts working.
>
>Why would a query work in psql but not perl?
>
>--
>Chris Bitmead
>mailto:chris@tech.com.au
>http://www.techphoto.org - Photography News, Stuff that Matters

+-------------------------+--------------------------------------+
| Stuart Rison            | Ludwig Institute for Cancer Research |
+-------------------------+ 91 Riding House Street               |
| Tel. (0171) 878 4041    | London, W1P 8BT, UNITED KINGDOM.     |
| Fax. (0171) 878 4040    | stuart@ludwig.ucl.ac.uk              |
+-------------------------+--------------------------------------+

pgsql-general by date:

Previous
From: David Warnock
Date:
Subject: 6.5 & Unicode
Next
From: "Christopher L. Cousins"
Date:
Subject: Re: [GENERAL] Old Versions?